package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;
import com.fr.report.script.core.FunctionHelper;

public class ACOSH extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    double d1 = 0.0D;
    for (int i = 0; i < paramArrayOfObject.length; ++i)
      if (paramArrayOfObject[i] instanceof Number)
      {
        double d2 = ((Number)paramArrayOfObject[i]).doubleValue();
        d1 = Math.log(d2 + Math.sqrt(d2 * d2 - 1.0D));
        break;
      }
    return FunctionHelper.parsePrimitiveDouble(d1);
  }

  public Function.Type getType()
  {
    return Function.MATH;
  }

  public String getCN()
  {
    return "ACOSH(number): 返回给定数值的反双曲余弦。\nNumber:返回值的双曲余弦。\n备注:\n    参数number的值必须大于或等于1。\n    ACOSH(COSH(number))=number。\n示例:\nACOSH(1)等于0。\nACOSH(8)等于2.768659383。\nACOSH(5.5)等于2.389526435。";
  }

  public String getEN()
  {
    return "ACOSH(number): Returns the inverse hyperbolic cosine of a number.\nNumber is the hyperbolic cosine of the return value.\nRemarks:\n    Number is any real number equal to or greater than 1.\n    ACOSH(COSH(number))=number。\nExample:\n   ACOSH(1)=0\n   ACOSH(8)=2.768659383\n   ACOSH(5.5)=2.389526435";
  }
}